﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Reflection;

namespace Tulde.WindowsPhone.Music.Mp3Tunes
{
    public class LockerSearchDataService<T> : LockerDataService<T>
    {
        //protected override void DataService_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        //{
        //    if (e.UserState != null)
        //    {


        //        object instance = this.DeserializeResult(e.Result);
        //        Tuple<object, object> state = (Tuple<object, object>)e.UserState;
        //        object action = state.Item2;


        //        Uri uri = state.Item1 as Uri;
        //        Type type = action.GetType();
        //        MethodInfo method = type.GetMethod("Invoke");
        //        //LateBoundMethod callback = DelegateFactory.Create(method);




        //        if (instance is ICacheable)
        //        {
        //            if (((ICacheable)instance).ShouldCache)
        //            {
        //                ViewModelCacheFactory.Instance.SetCacheItem(uri.OriginalString, instance);
        //            }
        //        }
        //        //else
        //        //{
        //        //    ViewModelCacheFactory.Instance.SetCacheItem(uri.OriginalString, instance);
        //        //}
        //        //callback.Invoke(action, new object[] { instance });
        //        method.Invoke(action, new object[] { instance });




        //    }
        //}
    }
}
